package chapter2;


import java.time.*;

import java.time.format.*;

import static java.time.temporal.TemporalAdjusters.firstInMonth;

public class Day04 {
    public static void main(String[] args) {

            LocalDate now = LocalDate.of(2023, Month.JANUARY, 1);// 查找一年中的第一个星期日
            LocalDate sunday = now.with(firstInMonth(DayOfWeek.SUNDAY));
            do { // 通过将Period.ofDays(7)添加到当前星期日来循环获取每个星期日。
                System.out.println(sunday.format(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)));
                sunday = sunday.plus(Period.ofDays(7));
            } while (sunday.getYear() == 2023);
        }



}
